const mysql = require('mysql')

var db = mysql.createConnection({host:'localhost',user:'root',password:'1234',database:'book'})

db.query("SELECT * FROM `from_book`;",function(err,data){
    if(err){
        console.log('失败' + err)
    }
    else{
        console.log('成功')
        console.log(JSON.stringify(data))
    }
})